Added file drag-n-drop for opening them#3731
Added file drag-n-drop for opening them#3731RobertoRoos wants to merge 2 commits intoControlSystemStudio:masterfrom
Conversation
|
I am completely new to Java and Phoebus, so I just started somewhere. The current version is extremely rough. |
| menuBar.setOnDragDropped(e -> { | ||
| final Dragboard db = e.getDragboard(); | ||
|
|
||
| if (db.hasFiles()) { | ||
| for (File file : db.getFiles()) { | ||
| this.openResource(file.toURI(), true); | ||
| } | ||
| } | ||
|
|
||
| e.setDropCompleted(true); | ||
| e.consume(); | ||
| }); |
There was a problem hiding this comment.
This works, but causes the dragged-file icon to still show on top of the UI file the 'Choose editor' dialog is open.
What is a neat way to delay the openResource() call by a little bit?
There was a problem hiding this comment.
Instead of calling this.openResource(...) right there, try deferring it to the next UI cycle via
Platform.runLater(() -> this.openResource(...));
| toolbar = createToolbar(); | ||
| createTopResourcesMenu(); | ||
|
|
||
| menuBar.setOnDragOver(e -> { |
There was a problem hiding this comment.
What would be a good location to put this event method? Because the event-handler should be shared, as I would like it to be called from other panels too.
|





Added feature to allow drag-and-drop of files to open them.
Resolves #3730
Checklist
Testing:
Documentation: